<template>
  <div class="home">
    <div class="header">
      <h1>剧本杀</h1>
      <p class="subtitle">沉浸式推理游戏体验</p>
    </div>

    <div class="content">
      <div class="action-buttons">
        <button class="btn btn-primary" @click="goToRoomList">进入房间</button>
        <button class="btn btn-secondary" @click="createRoom">创建房间</button>
      </div>

      <div class="features">
        <div class="feature-item">
          <div class="icon">🎭</div>
          <h3>角色扮演</h3>
          <p>选择你的角色，沉浸式体验</p>
        </div>
        <div class="feature-item">
          <div class="icon">🔍</div>
          <h3>推理探案</h3>
          <p>收集线索，找出真相</p>
        </div>
        <div class="feature-item">
          <div class="icon">👥</div>
          <h3>多人互动</h3>
          <p>与朋友一起体验剧本杀</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { useRouter } from "vue-router";
import axios from "axios";

export default {
  name: "Home",
  setup() {
    const router = useRouter();

    const goToRoomList = () => {
      router.push("/rooms");
    };

    const createRoom = () => {
      // 跳转到剧本选择页面
      router.push("/script-select");
    };

    return {
      goToRoomList,
      createRoom,
    };
  },
};
</script>

<style scoped>
.home {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
}

.header {
  text-align: center;
  padding: 60px 20px 40px;
}

.header h1 {
  font-size: 48px;
  font-weight: bold;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
  font-size: 16px;
  opacity: 0.9;
}

.content {
  max-width: 500px;
  margin: 0 auto;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 50px;
}

.btn {
  padding: 16px 32px;
  font-size: 18px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-primary {
  background: white;
  color: #667eea;
}

.btn-primary:active {
  transform: scale(0.98);
  background: #f0f0f0;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
}

.btn-secondary:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.3);
}

.features {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.feature-item {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 25px;
  border-radius: 16px;
  text-align: center;
}

.icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.feature-item h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.feature-item p {
  font-size: 14px;
  opacity: 0.9;
}
</style>

